﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ProjetS5
{
    public class Player : Character
    {
        public Player()
            : base(Vector2.Zero, Vector2.Zero, 1, null)
        {
        }

        public Player(Vector2 Position, Vector2 Orientation, byte Level, DB_CharacterRace Race, DB_CharacterClass CharacterClass, String Name)
            : base(Position, Orientation, Level, Race)
        {
            selectedTalents = new List<Talent>();
            doneAchievements = new List<DB_Achievement>();
            equipment = new Equipment();
            inLogQuests = new Dictionary<DB_Quest, Dictionary<DB_Objective, int>>();
            doneQuests = new List<DB_Quest>();
            inventory = new Inventory(4, 10);
            characterClass = CharacterClass;
            globalCooldownLeft = new TimeSpan();
            experience = 0;
            maxDifficultyCompleted = Difficulty.None;
            inProgressAchievements = new Dictionary<DB_Achievement, Dictionary<DB_Objective, int>>();
            name = Name;
            setBaseStats(characterClass.BaseStatistics);
            calculateNewStats(equipment, characterClass.Name);
            foreach (DB_PointBar pointBar in characterClass.PointBars)
            {
                int value = 0;
                value = (int)calculatedStatistics.Single(e => e.Key.Name == pointBar.Name).Value;
                pointBars.Add(pointBar, value);
            }
            foreach (DB_Ability ability in characterClass.Abilities)
            {
                abilities.Add(new Ability(ability));
            }
            friendshipLevelId = 3;
        }


        /// <summary>
        /// Everybody (prevent cheat)
        /// </summary>
        public List<Talent> selectedTalents;
        /// <summary>
        /// Server + Me
        /// </summary>
        public List<DB_Achievement> doneAchievements;
        /// <summary>
        /// Server + Me ?
        /// </summary>
        public Equipment equipment;
        /// <summary>
        /// Server + Me
        /// </summary>
        public Dictionary<DB_Quest, Dictionary<DB_Objective, int>> inLogQuests;
        /// <summary>
        /// Server + Me
        /// </summary>
        public List<DB_Quest> doneQuests;
        /// <summary>
        /// Server + Me
        /// </summary>
        public Inventory inventory;
        /// <summary>
        /// Everybody
        /// </summary>
        public DB_CharacterClass characterClass;
        /// <summary>
        /// Server + Me
        /// </summary>
        public TimeSpan globalCooldownLeft;
        /// <summary>
        /// Server + Me
        /// </summary>
        public int experience;
        /// <summary>
        /// Server + Me
        /// </summary>
        public Difficulty maxDifficultyCompleted;
        /// <summary>
        /// Server + Me
        /// </summary>
        public Dictionary<DB_Achievement, Dictionary<DB_Objective, int>> inProgressAchievements;
    }
}
